#include "pch.hpp"
#include "Hook.hpp"

#ifdef runsOnMainThread
	#undef runsOnMainThread
#endif



static boost::thread::id g_mainThreadId = boost::this_thread::get_id();




/**
 * Tests if the calling function runs on the main thread.
 * Asserts and throws if unsatisfied.
 */
void runsOnMainThread()
{
	boost::thread::id callingThreadId = boost::this_thread::get_id();

	BOOST_ASSERT( callingThreadId == g_mainThreadId );
	if( callingThreadId != g_mainThreadId )
		BOOSTEXT_THROW(boostext::programming_error( "Hooks cannot be used in any other but the main thread" ));
}
///////////////////////////////////////////////////////////////////////////////////////////////////
